package com.dd.ms.provider.config.feign.fallback;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.ms.provider.api.DataObjectFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author liuxianmeng
 * @CreateTime 2025/6/27 14:07
 * @Description 类功能作用说明
 */
@Slf4j
@Component
public class DataObjectFeignFallbackFactory implements FallbackFactory<DataObjectFeignClient> {

    @Override
    public DataObjectFeignClient create(Throwable cause) {
        return dataObjectPageQueryReq -> {
            // 返回空页或默认值
            log.error("Feign调用失败，启用降级", cause);
            return new Page<>();
        };
    }
}